﻿<Window x:Class="DemoDataBinding.ComboboxSample"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="ComboboxSample" Height="191" Width="300">
    <Window.Resources>
        <Style TargetType="Label">
            <Setter Property="Margin" Value="5"/>
            <Setter Property="HorizontalContentAlignment" Value="Right"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Background" Value="Wheat"/>
        </Style>
        <Style TargetType="ComboBox">
            <Setter Property="Margin" Value="5"/>
        </Style>
        <Style TargetType="TextBox">
            <Setter Property="Margin" Value="5"/>
        </Style>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Label Grid.Row="0" Grid.Column="0" Content="Please Choose: "/>
        <ComboBox Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Path=People}" DisplayMemberPath="Name" SelectedItem="{Binding Path=CurrentPerson}"/>

        <Label Grid.Row="1" Grid.Column="0">Id:</Label>
        <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=CurrentPerson.Id}"/>

        <Label Grid.Row="2" Grid.Column="0">Name:</Label>
        <TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Path=CurrentPerson.Name}"/>

        <Label Grid.Row="3" Grid.Column="0">Age:</Label>
        <TextBox Grid.Row="3" Grid.Column="1" Text="{Binding Path=CurrentPerson.Age}"/>

    </Grid>
</Window>
